Customize HAML-to-PHP
HAML-TO-PHP is designed to be extensible. You can customize many aspects of the compiler behaviour and output.
Options
$haml = new HamlFileCache(HAML_DIR, HAML_TEMPLATE_CACHE); // Produce prettier, indented HTML output $haml->options['ugly'] = false; // default: true // Set XHTML vs HTML output mode $haml->options['xhtml'] = true; // affects self-closing tags like <br/> // Enable or disable automatic HTML escaping $haml->options['escape_html'] = true; // default in HAML-TO-PHP: true
Custom Filters
You can add your own HAML filters. For example, to add a Markdown filter:
// Register a custom filter
$haml->filters['markdown'] = function($content) {
return Markdown($content);
};Custom Functions
To expose PHP functions to HAML templates, add them to the allowed list. By default, only a safe subset is permitted in online environments.
Questions about customization? Contact support.
Support